<?php
if (!defined('IN_XLP')) {
    exit('Access Denied'); 
}
$Document = array(
    'pageid' => 'news-editone', //页面标示
    'pagename' => '编辑单条图文', //当前页面名称
    'mycss' => array('content/appmsg'), //加载的css样式表
    'myjs' => array(), //加载的js脚本
    'footerjs'=>array('content/fuelux/fuelux', 'content/combodate/moment.min', '../ueditor/editor_config', '../ueditor/editor.min', 'content/operamasks-ui.min', 'content/appmsgn|2014120301'),   
    'head' => true, //加载头部文件
);

include getTpl('header', 'public');
?>
<!--顶部导航 开始-->
<?php include getTpl('top', 'public');?>
<!--顶部导航 结束-->
<!--左侧菜单 开始-->
<?php include getTpl('nav', 'public');?>
<!--左侧菜单 结束-->
<!--主体 开始-->
<!-- content -->
  <section id="content">
    <section class="main padder"> 
    <div class="clearfix"> 
     <h4><i class="fa fa-edit"></i>编辑身边事消息</h4> 
    </div> 
    <div class="row"> 
     <div class="col-sm-12"> 
      <section class="panel"> 
       <div class="panel-body"> 
        <!--添加单条图文  b-->
		<form id="appmsg-form" class="form" method="post">		
            <div class="span5 msg-preview" style="width:380px;float:left;">
                <div class="msg-item-wrapper">
                    <div id="appmsgItem1" class="msg-item appmsgItem1">
                      <h4 class="msg-t"><span class="i-title">标题</span></h4>
                      <p class="msg-meta"><span class="msg-date"><?php echo outTime($rs['header']['infotime'],2)?></span></p>
                      <div class="cover">
                      <?php
                      if (!$rs['header']['picurl']){
					  ?>
                        <p class="default-tip" >封面图片</p>
                        <?php
					  }
						?>
                        <img class="i-img"  style="" src="<?php echo getImgUrl($rs['header']['picurl']);?>"> </div>
                      <p class="msg-text"><?php echo $rs['header']['description'];?></p>
                    </div>
                    <div class="msg-hover-mask"></div>
                    <div class="msg-mask"><span class="dib msg-selected-tip"></span> </div>
                  </div>
                </div>
                <div class="span7" style="width:540px; float:left; margin-left:20px;">
                  <div class="msg-editer-wrapper">
                    <div class="msg-editer">
                        <div class="control-group">
                          <label class="control-label">标题</label>
                          <span class="maroon">*</span><span class="help-inline">(必填,不能超过64个字)</span>
                          <div class="controls">
                            <input type="text" id="title" class="form-control span5" style="width: 482px;" name="title" value="<?php echo $rs['header']['title'];?>"/>
                          </div>
                        </div>
                        <!--<div class="control-group">
                            <label class="control-label">来源</label><span class="help-inline">（选填）</span>
                            <div class="controls">
                                <input type="text" id="author" class="form-control span5" style="width: 482px;" name="author" value="<?php echo $rs['header']['author'];?>">
                            </div>
                        </div>-->
                        <div class="control-group">
                          <label class="control-label">列表页大图</label>
                          <div class="controls">
                            <div class="cover-area">
                              <div class="cover-hd">
                                <input id="file_upload" name="file_upload" type="file" />
                                <input id="coverurl" value="<?php echo $rs['header']['picurl'];?>" name="coverurl" type="hidden" />
                              </div>
                              <p id="upload-tip" class="upload-tip">大图尺寸：640*640</p>
                              <p id="imgArea" class="cover-bd"<?php if(!$rs['header']['picurl']){ echo 'style="display: none;"'; } ?>><img src="<?php echo getImgUrl($rs['header']['picurl']);?>" id="img">
                                  <a href="javascript:;" class="vb cover-del" id="delImg">删除</a>
                              </p>
                            </div>
                          </div>
                          <!--<div style="padding:5px 0;">
                                <input type="checkbox" id="isCover" name="isCover" <?php if ($rs['header']['is_putin']){echo 'checked="checked" value="1" ';}else{echo 'value="0" ';};?> style="width:15px; height:15px; margin-right:10px; vertical-align:middle;"><span style="vertical-align:middle;" >封面图片显示在正文中</span>
                            </div>-->
                        </div>
                        <div id="desc-block" class="control-group">
                          <label class="control-label">摘要</label>
                          <span class="help-inline">(不能超过120个字)</span>
                          <div class="controls">
                            <textarea name="summary" id="summary" class="msg-txta" style="height:90px"><?php echo $rs['header']['description'];?></textarea>
                          </div>
                        </div>
                        <div id="desc-block" class="control-group">
                          <label class="control-label">标签</label>
                          <span class="help-inline">(选择一个标签)</span>
                          <div class="controls">
                            <select class="form-control" style="width:30%; float:left;" name="tagid">
                            <?php    
                            foreach($taglist as $tk=>$dv){
								if($dv['status']==1){
							?>
                            <option value="<?php echo $dv['tag_id']; ?>" <?php if($rs['header']['tag_id']==$dv['tag_id']){ echo 'selected="selected"'; }?>><?php echo $dv['tag_title']; ?></option>
                            <?php
								}
							}
							?>
                            </select>
                            <div style=" margin-left:1em; height:34px; width:20%; line-height:34px; display:inline-block;"><a href="<?php echo U('nearby/tags_list');?>">标签管理</a></div>
                            <div class="clear"></div>
                          </div>
                        </div>
                        <div class="control-group">
                          <label class="control-label">正文</label>
                          <span class="maroon"></span><span class="help-inline">(不能超过20000个字)</span>
                          <div class="controls"> 
                            <script type="text/plain" id="editor"><?php echo $rs['header']['content'];?></script> 
                            <div id="uploadimages"></div>
                          </div>
                        </div>
                        <a id="url-block-link" href="javascript:void(0);" class="url-link block">添加来源</a>
                        <div id="url-block" <?php if (!$rs['header']['url']){echo 'style="display:none"';};?> class="control-group">
                          <label class="control-label">来源</label>
                          <span class="help-inline">(请输入正确的URL链接格式)</span>
                          <div class="controls">
                            <input type="text" id="source_url" class="form-control span5" style="width: 482px;" name="source_url" value="<?php echo $rs['header']['url'];?>" />
                          </div>
                        </div>
                        <div class="control-group">
                              <label class="control-label">排序值</label>
                              <span class="help-inline">数值越大越靠前（0-999）</span>
                              <div class="controls">
                                <input type="text" id="px" class="form-control span2" style="width:80px;" name="px" value="<?php echo $rs['header']['px'];?>" />
                              </div>
                        </div>
                        <div class="control-group">
                          <div class="controls">
                            <button id="save-btn" type="submit" class="btn btn-primary btn-large">保存</button>
                            <button id="cancel-btn" type="button" class="btn btn-large">取消</button>
                          </div>
                        </div>
                        <input name="tid" id="tid" type="hidden" value="<?php echo $rs['header']['tid'];?>">
                        <input name="id" id="id" type="hidden" value="<?php echo $rs['header']['id'];?>">
                        <input id="action" type="hidden" value="edit" />
                    </div>
                    <span class="abs msg-arrow a-out" style="margin-top: 0px;"></span> <span class="abs msg-arrow a-in" style="margin-top: 0px;"></span> </div>
                </div>
                <div class="clear"></div>
                </form>
            <!--添加单条图文  E-->
       </div> 
      </section>
     </div> 
    </div> 
   </section>
  </section> 
  <!--/ content --> 
<!--主体 结束-->
<script>
var UEDITOR_HOME_URL = '<?php echo LOCAL_PUBLIC_PATH;?>ueditor/';
var fixedImagePath='';
var gotoUrl='<?php echo U('nearby/index',array('tid'=>$rs['header']['tid']));?>';
var postUrl='<?php echo U('nearby/save');?>';
var postPicUrl='<?php echo U('nearby/postpic');?>';
var uploadUrl='<?php echo U('nearby/upload');?>';
function ueditorUploadCallBack(info){
	$("#uploadimages").append('<input type="hidden" name="editUplodeImage" value="'+info.url+'"/>');
	//console.log(info.url);
}
</script>
<?php
include getTpl('footer', 'public');
?>